<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>web</title>
		<meta name="description" content="Common UI Features &amp; Elements" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="assets/custom/css/main2.css" />
		<link rel="stylesheet" href="assets/css/font-awesome.min.css" />
		<link rel="stylesheet" href="assets/css/ace-fonts.css" />
		<link rel="stylesheet" href="assets/css/ace.min.css" />
		<link rel="stylesheet" href="assets/bootstrap-datepicker/css/bootstrap-datepicker.min.css" />
		<link rel="stylesheet" type="text/css" href="assets/jquery-easyui-1.4.4/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="assets/jquery-easyui-1.4.4/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="assets/uploadify/uploadify.css" />
		<link rel="stylesheet" type="text/css" href="assets/bootstrap3-dialog/css/bootstrap-dialog.min.css"  />
		<style type="text/css">
			.tabs-panels div[class="panel"] {
				padding: 10px;
			}
			.tabs-wrap {
				background-color: white;
			}
			.pagination {
				width: 100%;
			}
			.panel-header {
				padding: 15px;
				text-align: center;
				font-weight: 700;
			}
			.datagrid-row, .datagrid-header-row {
				height: 35px;
				font-size: 14px;
				text-align: center;
			}
			.datagrid-header-row .datagrid-cell {
				height: 35px;
			}
			.datagrid-header-row .datagrid-cell span {
				position: relative;
				top: 10px;
			}
			.for-head-wrap .datagrid-header-row .datagrid-cell {
				height: auto;
			}
			.for-head-wrap .datagrid-header-row .datagrid-cell span {
				position: relative;
				top: 0px;
				white-space: pre-wrap;
				word-break: break-all;
			}
			.well-no-padding {
				padding: 0px;
			}
		</style>

		<script type="text/javascript" src="assets/uploadify/jquery.js"></script>
		<script type="text/javascript" src="assets/uploadify/jquery.uploadify.min.js"></script>
		<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="assets/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
		<script src="assets/easy-ui/easyui-lang-zh_CN.js"></script>
		<script src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script type="text/javascript" src="assets/js/ace-extra.min.js"></script>
		<script type="text/javascript" src="assets/js/ace-elements.min.js"></script>
		<script type="text/javascript" src="assets/js/ace.min.js"></script>
		<script type="text/javascript" src="assets/js/jquery-form.js"></script>
		<script type="text/javascript" src="assets/js/fuelux/fuelux.wizard.min.js"></script>
		<script type="text/javascript" src="assets/js/fuelux/fuelux.wizard.min.js"></script>
		<script type="text/javascript" src="assets/js/jquery.validate.min.js"></script>
		<script type="text/javascript" src="assets/bootstrap3-dialog/js/bootstrap-dialog.min.js"></script>
		<script type="text/javascript" src="assets/bootstrap3-dialog/js/amms-dialog.js"></script>
	</head>

	<body class="no-skin">
		<div id="navbar" class="navbar navbar-default" style="height: 47px">
			<div class="navbar-container" id="navbar-container">
				<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<div class="navbar-header pull-left">
					<!-- #section:basics/navbar.layout.brand -->
					<a href="main" class="navbar-brand">
						<small> <%--  <img src="assets/avatars/logo.png" alt="" /> --%></small>
					</a>
				</div>

				<!-- #section:basics/navbar.dropdown -->
				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<li class="green">
							<a data-toggle="dropdown" class="dropdown-toggle" href="javascript:void(0)">
								<i class="ace-icon fa fa-envelope icon-animated-vertical"></i>
								<span class="badge badge-success">0</span>
							</a>
						</li>

						<!-- #section:basics/navbar.user_menu -->
						<li class="light-blue">
							<a data-toggle="dropdown" href="javascript:void(0)" class="dropdown-toggle">
								<img class="nav-user-photo" src="assets/avatars/user.jpg" alt="Jason's Photo" />
								<span class="user-info"> 欢迎您<br /> ${userName} </span>
								<i class="ace-icon fa fa-caret-down"></i>
							</a>
							<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<li>
									<a href="javascript:void(0)" onclick="logout()">
										<i class="ace-icon fa fa-power-off"></i>登出
									</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</div>
		</div>

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">
			<!-- #section:basics/sidebar -->
			<div id="sidebar" class="sidebar responsive">
				<ul class="nav nav-list">
					<li class="">
						<a href="javascript:void(0)" class="dropdown-toggle">
							<i class="menu-icon fa fa-home"></i>
							<span class="menu-text">首页</span>
							<b class="arrow fa fa-angle-down"></b>
						</a>
						<b class="arrow"></b>
						<ul class="submenu">
							<li class="">
								<a href="javascript:void(0)" onclick="openPage('findUserTasks','我的待办')">
									<i class="menu-icon fa fa-caret-right"></i>我的待办
								</a>
								<b class="arrow"></b>
							</li>
							<li class="">
								<a href="javascript:void(0)" onclick="openPage('findUserHistory','我的已办')">
									<i class="menu-icon fa fa-caret-right"></i>我的已办
								</a>
								<b class="arrow"></b>
							</li>
						</ul>
					</li>
					
					<!-- activeMQ -->
					<li class="">
						<a href="javascript:void(0)" class="dropdown-toggle">
							<span class="menu-text">消息队列</span>
							<b class="arrow fa fa-angle-down"></b>
						</a>
						<b class="arrow"></b>
						<ul class="submenu">
							<li class="">
								<a href="javascript:void(0)" onclick="openPage('activeMqView','ActiveMQ')">
									<i class="menu-icon fa fa-caret-right"></i>ActiveMQ
								</a>
								<b class="arrow"></b>
							</li>
						</ul>
					</li>
					<!-- activeMQ end-->
					
					<!-- activitiBPM -->
					<li class="">
						<a href="javascript:void(0)" class="dropdown-toggle">
							<span class="menu-text">工作流</span>
							<b class="arrow fa fa-angle-down"></b>
						</a>
						<b class="arrow"></b>
						<ul class="submenu">
							<li class="">
								<a href="javascript:void(0)" onclick="openPage('activitiDefView','流程定义列表')">
									<i class="menu-icon fa fa-caret-right"></i>流程定义列表
								</a>
								<b class="arrow"></b>
							</li>
						</ul>
					</li>
					<!-- activitiBPM end-->
					
				</ul>
				<shiro:hasPermission name="add">
				 <a href="createUser.jsp">Create a new User</a>
				</shiro:hasPermission>
   					
				<!-- #section:basics/sidebar.layout.minimize -->
				<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
					<i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
				</div>
			</div>
			<!-- /section:basics/sidebar -->
			<div class="main-content">
		    	<div class="page-content">
		    		<div class="page-content-area">
		    			<div class="row">
		    				<div class="col-xs-12">
		    					<div class="widget-box">
		    						<div class="widget-header widget-header-blue widget-header-flat well-no-padding">
			    						<div class="easyui-tabs" data-options="tabHeight:36" id="main_tabs">
				    						<div title="<i class='green ace-icon fa fa-home bigger-120'></i><span style='padding-left:5px;'>首页</span>">
				    							<p>welcome!</p>
				    						</div>
			    						</div>
		    						</div>
		    					</div>
		    				</div>
						</div>
					</div>
				</div>
			</div>
			<!-- /section:basics/footer -->
			<div class="footer">
				<div class="footer-inner">
					<!-- #section:basics/footer -->
					<div class="footer-content">
						<span class="bigger-100">Copyright </span>
					</div>
				</div>
			</div>

			<a href="javascript:void(0)" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
			</a>
		</div>

		
	</body>

	<script type="text/javascript">
		/*session超时后，发送ajax请求，shiro无法做出正确的跳转到登录页面的操作，此处做一个全局ajax操作判断，若出现此情况，XMLHttpRequest.responseText返回的是login的html代码，textStatus返回的是错误parsererror*/
		$.ajaxSetup({
			complete : function(XMLHttpRequest, textStatus) {
				if (XMLHttpRequest.responseText != undefined
					&& (XMLHttpRequest.responseText .indexOf('id="login_content"') != -1)
					&& textStatus == "parsererror") {
					window.location.href = '${pageContext.request.contextPath}/login';
				}
			}
		});

		$(function() {
			
			$('#sidebar-collapse').click(function() {
				var title = $('.tabs-selected').text();
				setTimeout(function() {
					$('#main_tabs').tabs({
						width : $("#main_tabs").parent().width()
					});
					var $panel = $('.tabs-panels div[class="panel"]');
					var $div = $('div[class="panel-body panel-body-noheader panel-body-noborder"]');
					$panel.css('width', $("#main_tabs").parent().width());
					$div.css('width', $div.parent().width());
					$('#main_tabs').tabs('select', title);
					var $datagridParent = $('.datagrid').parent();
					var tables = $datagridParent.find('table[class="datagrid-f"]');
					for (var i = 0; i < tables.length; i++) {
						var $id = "#" + tables[i].getAttribute("id");
						$($id).datagrid('resize', {
							width : $datagridParent.width()
						});
					}
					/* jqGrid自适应 样式调整 */
					var jqGridTable = $('.jqGridTable');
					if (0 < jqGridTable.length) {
						var mainWidth = jqGridTable.parents("div[name='edtItemMainContent']").width();
						jqGridTable.jqGrid('setGridWidth', mainWidth);
					}
				}, 10);
			
			});
			/* 监听主窗口大小变化, */
			$(window).resize(function(){
				$('#main_tabs').tabs("resize");
			});
			$('.menu-icon.fa.fa-caret-right').css('top', '20px');
			$('#main_tabs').tabs({
				onSelect : function(title, index) {
					var href = $('#main_tabs').tabs('getSelected').panel('options').href;
					var miId = "#" + href + "MiId";
					var miValue = $(miId).val();
					if (miValue != undefined && miValue != '') {
						$('#' + miValue).modal('show');
						$(miId).val('');
					}
					// 获取当前的TAB
					var $currPop = $('#main_tabs').tabs('getSelected').find('[data-toggle="popover"]');
					if ($currPop && $currPop.length > 0) {
						$currPop.popover('destroy');
					}
				},
				onBeforeClose : function(title, index) {
					// 获取当前的TAB
					var $currPage = $('#main_tabs').tabs('getSelected');
					closeMaterialTab2(title);
					// 气泡
					var $currPop = $currPage.find('[data-toggle="popover"]');
					if ($currPop && $currPop.length > 0) {
						$currPop.popover('destroy');
					}
					// 关闭
					return true;
				},
				onLoad : function(panel) {
					// 调整 panel-body 样式
					var $div = $(panel);
					$div.css('width', $div.parent().width());
				}
			});
		});

		function closeMaterialTab2(title) {
			
		}

		function closeMaterialTab(materialCurrentPage, type) {
			if (materialCurrentPage && materialCurrentPage.length > 0) {
				if ("po" == type || "poQty" == type) {
					poLogout(type);
				}
				if ("ro" == type || "roQty" == type) {
					roLogout(type);
				}
			}
		}

		

		

		//indexOf方法在ie下需要定义
		Array.prototype.indexOf = function(val) {
			for (var i = 0; i < this.length; i++) {
				if (this[i] == val) {
					return i;
				}
			}
			return -1;
		};

		
		//登出
		function logout() {
			$.get("logout", function(result) {
				window.location.href = "login";
			});
		}
		// 开启功能页面入口
		function openPageByParam(page, title, param) {
			mainOpen(page, title, {
				title : title,
				href : page,
				method : 'post',
				closable : true,
				queryParams : {
					"reportTimes" : param
				}
			});
		}
		// 开启功能页面入口
		function openPage(page, title) {
			mainOpen(page, title, {
				title : title,
				href : page,
				method : 'post',
				closable : true
			});
		}
		function mainOpen(page, title, param) {
			var exists = $('#main_tabs').tabs('exists', title);
			if (!exists) {
				$('#main_tabs').tabs('add', param);
				var $div = $('div[class="panel-body panel-body-noheader panel-body-noborder"]');
				$div.css('width', $div.parent().width());
				$div.css('overflow', 'hidden');
			} else {
				$('#main_tabs').tabs('select', title);
			}
		}
	</script>
	<!--[if lte IE 9]>
			<link rel="stylesheet" href="assets/css/ace-part2.min.css" />
		<![endif]-->
	<!--[if lte IE 9]>
			<link rel="stylesheet" href="assets/css/ace-ie.min.css" />
			<script src="assets/js/ace-extra.min.js"></script>
		<![endif]-->
	<!--[if lte IE 8]>
			<script src="assets/js/jquery.placeholder.min.js"></script>
			<script src="assets/js/html5shiv.min.js"></script>
			<script src="assets/js/respond.min.js"></script>
		<![endif]-->
</html>